namespace ghost {
    export class ComCreator {
        public static createSlider(pr: Laya.Sprite = null, label: string = "", x: number = 0, y: number = 0, min: number = 0, max: number = 100, value: number = 0, skin = "com_atlas/hslider.png"): SliderInput {
            let s = this;
            let slider: SliderInput;
            slider = new SliderInput(label, min, max, value);
            slider.x = x;
            slider.y = y;
            slider.slider.skin = skin;            
            slider.slider.tick = 1;
            if (pr)
                pr.addChild(slider);
            return slider;
        }
        public static createButton(pr: Laya.Sprite = null, label: string = "", x: number, y: number, w: number, h: number, skin: string, fontSize: number = 18, fontColor: string = "#000000", btnCls: any = null): Laya.Button {
            if (btnCls == null)
                btnCls = Laya.Button;
            let btn: Laya.Button = new btnCls;
            if (skin)
                btn.skin = skin;
            btn.x = x;
            btn.y = y;
            btn.width = w;
            btn.height = h;
            btn.label = label;
            btn.labelSize = fontSize;
            btn.labelColors = fontColor;
            btn.stateNum = 1;

            if (pr)
                pr.addChild(btn);
            return btn;
        }
        public static createText(pr: Laya.Sprite = null, label: string, x: number = 0, y: number = 0, w: number = 100, h: number = 30, color: string = "#000000", size: number = 20): Laya.Text {
            let txt: Laya.Text;
            txt = new Laya.Text;
            txt.text = label;
            txt.x = x;
            txt.y = y;
            txt.color = color;
            txt.fontSize = size;
            txt.width = w;
            txt.height = h;
            if (pr)
                pr.addChild(txt);
            return txt;
        }
        public static createTextArea(pr: Laya.Sprite = null, content: string, x: number = 0, y: number = 0, w: number = 100, h: number = 30, color: string = "#000000", size: number = 20): Laya.TextArea {
            let txt: Laya.TextArea;
            txt = new Laya.TextArea;
            txt.text = content;
            txt.x = x;
            txt.y = y;
            txt.color = color;
            txt.fontSize = size;
            txt.width = w;
            txt.height = h;
            if (pr)
                pr.addChild(txt);
            return txt;
        }
        public static createList(itemCls:any,pr: Laya.Sprite = null, x: number = 0, y: number = 0, w: number = 100, h: number = 500, defaultHandle:boolean=true):Laya.List
        {
            let list:BaseList;
            list = new BaseList;
            list.x = x;
            list.y = y;
            list.width = w;
            list.height = h;
            list.itemRender = itemCls;
            list.vScrollBarSkin = "";
            list.scrollBar.hide = false;
            list.mouseEnabled = true;
            list.mouseThrough = false;
            list.selectEnable = true;
            if(defaultHandle)            
                list.useDefaultHandle();            
            if (pr)
                pr.addChild(list);
            return list;
        }        
    }
}
